<template>
  <div>
    <el-form ref="teacher " :model="teacher" :inline="true" class="query-bar">
      <div class="query-row demo-form-inline">
        <div>
          <el-form-item>
            <el-button type="primary" @click="insertNewsTeacher"
              >添加学院</el-button
            >
          </el-form-item>
        </div>
        <div>
          <el-form-item>
            <el-select
              v-model="teacher.roles"
              filterable
              placeholder="角色"
              @change="doQuery"
              class="teacherrole"
            >
              <el-option label="角色" value=""></el-option>
              <!-- <el-option
                v-for="(roles, index) in rolesList"
                v-if="index > 0"
                :label="roles"
                :value="index"
              ></el-option> -->
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-input
              maxlength="30"
              v-model="teacher.teacherName"
              placeholder="请输入关键字"
              class="sou"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button @click="find">查询</el-button>
          </el-form-item>
        </div>
      </div>
    </el-form>

    <p>总条数：39</p>

    <div class="lx-table">
      <lx-table
        ref="myTable"
        :tableData="trainTypeList"
        :tableCols="tableCols"
        isIndex
        isSelection
        :currentPage="teacher.pageNum"
        :total="teacher.total"
        :pageSize="teacher.pageSize"
        @sizeChange="sizeChange"
        @currentChange="currentChange"
        @batchDel="batchDel"
      >
        <template slot="bottomOperate">
          <div>已选 0</div>
          <el-button class="batch-del" @click="deletes">批量删除</el-button>
        </template>
      </lx-table>
    </div>

    <el-dialog :title="editFormTitle" :visible.sync="editFormVisible">
      <el-form :model="editForm" :rules="editRules">
        <el-form-item label="学院名称" prop="teacherName" class="formitem">
          <el-input
            v-model="editForm.teacherName"
            autocomplete="off"
            class="el-inputs"
          ></el-input>
        </el-form-item>
        <el-form-item label="简介" prop="synopsis" class="formitem">
          <el-input
            type="textarea"
            v-model="editForm.synopsis"
            autocomplete="off"
          ></el-input>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="editFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="editFormVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>
   
<script>
import LxTable from "@/components/LxTable.vue";
export default {
  components: {
    "lx-table": LxTable,
  },
  data() {
    return {
      teacher: {
        teacherName: "",
        pageSize: 10,
        pageNum: 1,
        total: 0,
        roles: "",
      },
      tableCols: [
        {
          label: "学院名称",
          prop: "organizeName",
          align: "center",
        },
        {
          label: "简介",
          prop: "synopsis",
          align: "center",
        },
        {
          label: "操作",
          type: "Button",
          btnList: [
            {
              type: "text",
              label: "编辑",
              handle: (that, row) => this.edit(that, row),
            },
            {
              type: "text",
              label: "删除",
              handle: (that, row) => this.del(that, row),
            },
          ],
          width: 250,
          align: "center",
        },
      ],
      rolesList: [""],
      trainTypeList: [],
      editFormTitle: "添加学院",
      editFormVisible: false,
      editForm: {
        teacherName: "",
        synopsis: "",
      },
      editRules: {
        teacherName: [
          {
            required: true,
            message: "请输入组织名称",
            trigger: "blur",
          },
        ],
      },
      centerDialogVisible: false,
      rules: {},
    };
  },
  methods: {
    insertNewsTeacher() {
      this.editFormVisible = true;
    },
    find() {},
    sizeChange() {},
    currentChange() {},
    batchDel() {},
    deletes() {},
    doQuery() {},
  },
};
</script>

<style lang="scss">
.teacherrole {
  width: 168px;
  height: 40px;
  background: #ffffff;
  border: 1px solid #dcdcdc;
  opacity: 1;
  border-radius: 2px;
}
.batch-del {
  margin-left: 30px;
}
.sou {
  width: 228px !important;
  height: 40px;
  background: #ffffff;
  border: 1px solid #dcdcdc;
  opacity: 1;
  border-radius: 2px;
}
.el-dialog {
  width: 800px;
  height: 389px;
  background: #ffffff;
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 1;
  border-radius: 4px;
}
.el-dialog__title {
  width: 64px;
  height: 21px;
  font-size: 16px;
  font-family: Microsoft YaHei;
  font-weight: bold;
  line-height: 22px;
  color: #000000;
  opacity: 1;
  margin-left: 20px;
}
.el-dialog__body {
  background: #fff;
  margin-top: 0;
  margin: 0 auto;
}
.el-inputs {
  width: 588px;
  height: 40px;
  background: #ffffff;
  border: 1px solid #dcdcdc;
  opacity: 1;
  border-radius: 4px;
}
.el-form-item__label {
  width: 135px;
  height: 40px;
  font-size: 14px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  line-height: 40px;
  color: #333333;
  opacity: 1;
  padding: 0 25px 0 0;
}
.el-dialog__header {
  height: 53px;
  line-height: 53px;
}
.formitem {
  margin-top: 20px;
  //   text-align: center;
}
.el-textarea__inner {
  width: 588px;
  height: 120px;
  background: #ffffff;
  border: 1px solid #dcdcdc;
  opacity: 1;
  border-radius: 4px;
  //   resize: none;
}
.el-textarea {
  width: 0;
}
.el-dialog__footer {
  margin: 0 auto;
  text-align: center;
}
</style>
